using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using BA.DAL;
using Microsoft.VisualBasic;
using System.Data.Common;

namespace BlazeApps.Library.Polls
{
    public class PollList : Base
    {
        private BA.DAL.DBUtility DAL = new BA.DAL.DBUtility();
        private Procedures Procs = new Procedures();

        public DataTable GetPollResults(Guid PollID)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@pollid", PollID);

            return DAL.GetDataTable(Procs.ListPollResults.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataTable GetPollQuestions()
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            return DAL.GetDataTable(Procs.ListPollQuestions.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open);
        }

        public DataTable GetPollQuestions(Guid UserID)
        {
            DAL.CreateDBObjects(ConnectionString, Provider);

            DAL.AddParameter("@userid", DbType.Guid, UserID);
            return DAL.GetDataTable(Procs.ListPollsByUser.ToString().Trim(), System.Data.CommandType.Text, System.Data.ConnectionState.Open); 
        }
    }
}
